<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ include file="/pages/inc/taglibs.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>PTS专家工作台</title>
	<%@ include file="/pages/inc/header.jsp" %>
</head>

<body>
<%@ include file="/pages/inc/common.jsp" %>
<%@ include file="/pages/inc/menu.jsp" %>

<div class="pts-main">
	<%@ include file="/pages/inc/nav_pro.jsp" %>
	<div class="pts-page-title"><span>任务详情</span></div>
	<input type="hidden"  id="proID" value="<c:out value='${proID}'/>"/>
	<input type="hidden"  id="status" value="<c:out value='${status}'/>"/>
	<input type="hidden"  id="taskId" value="<c:out value='${taskId}'/>"/>
	<div class="container-fluid">
	   <p>任务名称：Code review-JAVA类项目代码审查
	   <p>采购服务类型：Code review-JAVA类项目代码审查
	  	<p>详情描述：
	  	<p>1、检查代码命名规范等，对于可以优化的部分提出解决方案。
	  	<p>2、请重点检查是否存在影响效率的代码。并提出解决方案。
	  	<p>3、请重点检查是否有内存泄露等严重问题。
	    <div id="proshowbyID"></div>
	</div>
	<div class="pts-page-title"><span>我的工作台</span></div>
	<div id="handling" class="container-fluid">
    	<div class="pts-workbench-box">
    		到Crucible进行代码评审
    		<a href="http://115.29.76.124:8060/cru/<c:out value='${reviewId}'/>" target="_blank">（点击查看）</a>
    	</div>
		<div class="pts-workbench-box">
			上传工作结果文档
			<a href="<c:url value='/pro/workbenchPost'/>">（点击进入）</a>
		</div>
	</div>
	<button id="acceptButton" type="button" class="btn" onclick="operate(0);">接受</button>
	<button id="rejectButton" type="button" class="btn" onclick="operate(1);">拒接</button>
	<button id="confirmButton" type="button" class="btn" onclick="operate(2);">确认收款</button>
	<button id="backButton" type="button" class="btn" onclick="history.go(-1);">返回</button>
</div>
<%@ include file="/pages/inc/footer.jsp" %>
<script type="text/javascript">
window.onload = function showProInfo(){
	var proID = $("#proID").val();
	var status = $("#status").val();
	$.ajax({
		url: contextPath+"/codePackages/getProInfoByID",
		type:"POST",
		data:{"proID":proID},
		cache:false,
		async:false,
		success: function(data, textStatus, jqXHR){
			var html = "";
			    html += "最晚完成时间："+data.dueenddate;
			    html += "<br>";
                html += "采购项目:"+data.projectname;
                html += "<br>";
                html += "项目经理："+data.manager;
                html += "<br>";
                html += "项目结束时间："+data.dueenddate;
                html += "<br>";
            var divshow = $("#proshowbyID");
            divshow.append(html);
            // 判断任务状态
   		  switch(status){
   		    //执行中
 			case "0": $("#acceptButton").hide();$("#rejectButton").hide();
			          $("#backButton").hide();$("#confirmButton").hide();
			break;
			//待验收
			case "1": $("#handling").hide();$("#confirmButton").hide();
			break;
			//驳回
			case "2": $("#handling").hide();$("#acceptButton").hide();
	                  $("#rejectButton").hide();$("#confirmButton").hide();
			break;
			//待确认收款
			case "3": $("#handling").hide();$("#acceptButton").hide();$("#rejectButton").hide();
			break;
			//交易完成
			case "4": $("#handling").hide();$("#acceptButton").hide();
			          $("#rejectButton").hide();$("#confirmButton").hide();
			break; 
		  }
		},
	});
	};

	function operate(type){
		var taskId = $("#taskId").val();
		$.ajax({
			url: contextPath+"/pro/operateTask",
			type:"POST",
			data:{"type":type,"taskId":taskId},
			cache:false,
			async:false,
			success: function(data, textStatus, jqXHR){
				history.go(-1);
			},
	      });
		}
</script>
</body>
</html>
